using System;
using UnityEngine;
using UnityEngine.EventSystems;
using Voodoo.Pattern;

public class ShopButtonGroup : SingletonMB<ShopButtonGroup>
{
	public SkinButton SkinButton;

	public UpgradesButton UpgradesButton;

	public CityBuilderButton CityBuilderButton;

	private EventSystem eventSystem;

	private void Start()
	{
		MessageCenter instance = SingletonMB<MessageCenter>.Instance;
		instance.OnSettingsShow = (Action)Delegate.Combine(instance.OnSettingsShow, new Action(SettingsShow));
		eventSystem = UnityEngine.Object.FindObjectOfType<EventSystem>();
		SkinButton skinButton = SkinButton;
		skinButton.OnClicked = (Action)Delegate.Combine(skinButton.OnClicked, (Action)delegate
		{
			UpgradesButton.SwitchState(ShopButtonState.Hidden);
			SingletonMB<UpgradesContainer>.Instance.Hide();
			SingletonMB<IncrementalContainer>.Instance.Hide();
			SingletonMB<UIManager>.Instance.HideLeftBtns();
		});
		UpgradesButton upgradesButton = UpgradesButton;
		upgradesButton.OnClicked = (Action)Delegate.Combine(upgradesButton.OnClicked, (Action)delegate
		{
			SkinButton.SwitchState(ShopButtonState.Hidden);
			SingletonMB<SkinContainer>.Instance.Hide();
			SingletonMB<IncrementalContainer>.Instance.Hide();
			SingletonMB<UIManager>.Instance.HideLeftBtns();
		});
		UpgradesButton upgradesButton2 = UpgradesButton;
		upgradesButton2.AnimationComplete = (Action)Delegate.Combine(upgradesButton2.AnimationComplete, new Action(AnimCompleted));
		UpgradesButton upgradesButton3 = UpgradesButton;
		upgradesButton3.AnimationStarted = (Action)Delegate.Combine(upgradesButton3.AnimationStarted, new Action(AnimStarted));
		SkinButton skinButton2 = SkinButton;
		skinButton2.AnimationComplete = (Action)Delegate.Combine(skinButton2.AnimationComplete, new Action(AnimCompleted));
		SkinButton skinButton3 = SkinButton;
		skinButton3.AnimationStarted = (Action)Delegate.Combine(skinButton3.AnimationStarted, new Action(AnimStarted));
		GameManager instance2 = SingletonMB<GameManager>.Instance;
		instance2.OnGameStart = (Action)Delegate.Combine(instance2.OnGameStart, new Action(GameStarted));
	}

	private void GameStarted()
	{
		SingletonMB<SkinContainer>.Instance.Hide();
		SingletonMB<UpgradesContainer>.Instance.Hide();
		SkinButton.SwitchState(ShopButtonState.Hidden);
		UpgradesButton.SwitchState(ShopButtonState.Hidden);
		SingletonMB<IncrementalContainer>.Instance.Show();
	}

	private void SettingsShow()
	{
		SkinButton.SwitchState(ShopButtonState.Hidden);
		SingletonMB<SkinContainer>.Instance.Hide();
		UpgradesButton.SwitchState(ShopButtonState.Hidden);
		SingletonMB<UpgradesContainer>.Instance.Hide();
		SingletonMB<IncrementalContainer>.Instance.Show();
	}

	public void HideUpgrades()
	{
		UpgradesButton.SwitchState(ShopButtonState.Hidden);
		SingletonMB<IncrementalContainer>.Instance.Show();
		SingletonMB<UIManager>.Instance.ShowLeftBtns();
	}

	public void HideSkins()
	{
		SkinButton.SwitchState(ShopButtonState.Hidden);
		SingletonMB<IncrementalContainer>.Instance.Show();
		SingletonMB<UIManager>.Instance.ShowLeftBtns();
	}

	private void AnimStarted()
	{
		eventSystem.enabled = false;
	}

	private void AnimCompleted()
	{
		eventSystem.enabled = true;
	}

	private void Update()
	{
	}
}
